home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / biz / haage / WarpUP_V31.lha / WarpUP-WarpOS / WarpRace / ModSrc / ContextSwitch / pixelomania.s < prev   
Text File  |  1997-09-24  |  6KB  |  215 lines

  1.                 incdir  include:
  2.                 incdir  lvo:
  3.                 incdir  powerasm:source/powerpc_lib/warprace/
  4.  
  5. **      '(C) Copyright 1997 Haage & Partner Computer GmbH'
  6. **           All Rights Reserved
  7.  
  8.                 include intuition/intuition.i
  9.                 include powerpc/powerpc.i
  10.                 include warprace.i
  11.  
  12.                 include exec_lib.i
  13.                 include intuition_lib.i
  14.                 include graphics_lib.i
  15.                 include powerpc_lib.i
  16.  
  17.                 xref    PixelOMania_PPC
  18.                 xref    _LinkerDB
  19.  
  20.                 xdef    _SysBase
  21.                 xdef    _GfxBase
  22.                 xdef    _PowerPCBase
  23.                 xdef    _Window
  24.  
  25. VERSION         =       1
  26. REVISION        =       0
  27. REVISIONCOUNT   =       1
  28.  
  29.                 mc68020
  30.  
  31.                 section "",code
  32. start
  33.                 movem.l d1-a6,-(sp)
  34.                 lea     _LinkerDB,a4
  35.                 cmp.l   #WR_ID,d0
  36.                 beq.b   .go
  37.                 movem.l (sp)+,d1-a6
  38.                 moveq   #0,d0
  39.                 rts
  40. .go
  41.                 lea     ErrParams,a3
  42.                 move.l  a0,a2
  43.                 move.l  WRI_POWERPCBASE(a2),_PowerPCBase
  44.                 move.l  $4.w,_SysBase
  45.                 lea     int_name,a1
  46.                 move.l  a1,(a3)
  47.                 moveq   #0,d0
  48.                 move.l  d0,4(a3)
  49.                 lea     LibErr,a5
  50.                 CALLEXEC        OpenLibrary
  51.                 move.l  d0,_IntuitionBase
  52.                 beq.b   .error
  53.                 lea     graf_name,a1
  54.                 move.l  a1,(a3)
  55.                 moveq   #0,d0
  56.                 move.l  d0,4(a3)
  57.                 lea     LibErr,a5
  58.                 CALLEXEC        OpenLibrary
  59.                 move.l  d0,_GfxBase
  60.                 beq.b   .error
  61.                 sub.l   a0,a0
  62.                 lea     WinErr,a5
  63.                 lea     WindowTags,a1
  64.                 CALLINT         OpenWindowTagList
  65.                 move.l  d0,_Window
  66.                 beq.b   .error
  67.                 tst     WRI_68K(a2)
  68.                 bne     .notPPC
  69.                 move.l  a2,a0
  70.                 RUNPOWERPC      PixelOMania_PPC
  71.                 lea     Abort,a5
  72.                 tst.l   d0
  73.                 beq.w   .error
  74.                 bra.w   .done
  75. .notPPC
  76.                 move.l  d0,a0
  77.                 move.l  wd_RPort(a0),d7
  78.                 moveq   #0,d3
  79.                 moveq   #0,d4
  80.                 moveq   #0,d5
  81.                 moveq   #1,d6
  82.                 move.l  WRI_STARTTIMER_68K(a2),a1
  83.                 jsr     (a1)
  84. .loop
  85.                 move.l  _Window,a0
  86.                 move.l  wd_UserPort(a0),a0
  87.                 CALLEXEC        GetMsg
  88.                 tst.l   d0
  89.                 beq.b   .nomsg
  90.                 move.l  d0,a0
  91.                 move.l  im_Class(a0),d0
  92.                 and.l   #IDCMP_MOUSEBUTTONS,d0
  93.                 beq.b   .nomsg
  94.                 moveq   #-1,d5
  95.                 move.l  a0,a1
  96.                 CALLEXEC        ReplyMsg
  97. .nomsg
  98.                 tst.l   d5
  99.                 beq.b   .continue
  100.                 lea     Abort,a5
  101.                 bra.b   .error
  102. .continue
  103.                 move.l  d7,a1
  104.                 move.l  d6,d0
  105.                 eori.l  #2,d6
  106.                 CALLGRAF        SetAPen
  107.                 move.l  d7,a1
  108.                 move.l  d3,d0
  109.                 move.l  d4,d1
  110.                 CALLGRAF        WritePixel
  111.                 addq.l  #1,d3
  112.                 cmp.l   #96,d3
  113.                 blt.b   .loop
  114.                 moveq   #0,d3
  115.                 addq.l  #1,d4
  116.                 cmp.l   #64,d4
  117.                 blt.b   .loop
  118. .cont
  119.                 move.l  WRI_STOPTIMER_68K(a2),a1
  120.                 jsr     (a1)
  121. .done
  122.                 move.l  d0,Result
  123.                 divul.l #1000000,d1:d0
  124.                 move.l  d0,ResultParams
  125.                 move.l  d1,ResultParams+4
  126.                 move.l  #STATUS_SUCCESS,Status
  127.                 bra.b   .end
  128. .error
  129.                 move.l  #STATUS_ERROR,Status
  130.                 move.l  a5,ErrStr
  131. .end
  132.                 move.l  _Window,d0
  133.                 beq.b   .nowin
  134.                 move.l  d0,a0
  135.                 CALLINT         CloseWindow
  136. .nowin
  137.                 move.l  _IntuitionBase,d0
  138.                 beq.b   .noint
  139.                 move.l  d0,a1
  140.                 CALLEXEC        CloseLibrary
  141. .noint
  142.                 move.l  _GfxBase,d0
  143.                 beq.b   .nograf
  144.                 move.l  d0,a1
  145.                 CALLEXEC        CloseLibrary
  146. .nograf
  147.                 move.l  #WRO,d0
  148.                 movem.l (sp)+,d1-a6
  149.                 rts
  150.  
  151.  
  152.  
  153.                 section "",data
  154. WRO
  155.                 dc.l    ModName
  156.                 dc.l    Short
  157.                 dc.l    Description
  158.                 dc.l    Author
  159.                 dc.l    VERSION
  160.                 dc.l    REVISION
  161.                 dc.l    REVISIONCOUNT
  162.                 dc.l    0
  163. Result
  164.                 dc.l    0
  165.                 dc.l    RES_MICROSECS
  166.                 dc.l    ResultString
  167.                 dc.l    ResultParams
  168. Status
  169.                 dc.l    0
  170. ErrStr
  171.                 dc.l    0
  172.                 dc.l    ErrParams
  173.                 dc.l    0
  174.  
  175. ModName         dc.b    "PixelOMania",0
  176. Short           dc.b    "CPU context switch test program",0
  177. Description     dc.b    "This program measures the performance of the CPU context\n"
  178.                 dc.b    "switches. Every iteration consists of 4 AMIGA-OS system calls.\n"
  179.                 dc.b    "68K version included to compare with native speed",0
  180. Author          dc.b    "Sam Jordan",0
  181. ResultString    dc.b    "Elapsed time: %ld.%06ld seconds",0
  182.  
  183. LibErr          dc.b    "Failed to open %s V%ld",0
  184. WinErr          dc.b    "Failed to open the window",0
  185. Abort           dc.b    "Program aborted",0
  186.  
  187. int_name        INTNAME
  188. graf_name       GRAFNAME
  189.                 cnop    0,4
  190.  
  191.  
  192. WindowTags      dc.l    WA_Left
  193.                 dc.l    100
  194.                 dc.l    WA_Top
  195.                 dc.l    100
  196.                 dc.l    WA_Width
  197.                 dc.l    96
  198.                 dc.l    WA_Height
  199.                 dc.l    64
  200.                 dc.l    WA_Activate
  201.                 dc.l    -1
  202.                 dc.l    WA_IDCMP
  203.                 dc.l    IDCMP_MOUSEBUTTONS
  204.                 dc.l    TAG_DONE
  205.  
  206.  
  207.                 section "",bss
  208. _SysBase        ds.l    1
  209. _IntuitionBase  ds.l    1
  210. _GfxBase        ds.l    1
  211. _PowerPCBase    ds.l    1
  212. _Window         ds.l    1
  213. ResultParams    ds.l    2
  214. ErrParams       ds.l    2
  215.